package com.kelvin.paopao.module.market.market.orderdetail;

import android.content.Context;
import android.content.Intent;
import android.widget.ImageView;
import android.widget.TextView;

import com.kelvin.kelvinlib.imageloader.GlideUtil;
import com.kelvin.paopao.R;
import com.kelvin.paopao.api.responseBean.OrderModel;
import com.kelvin.paopao.module.base.BaseActivity;
import com.kelvin.paopao.widgets.CustomToolbar;

import butterknife.BindView;

/**
 * Created by MCK on 2017/5/27.
 */

public class OrderDetailActivity extends BaseActivity {
    @BindView(R.id.custom_toolbar)
    CustomToolbar customToolbar;
    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.tv_phone)
    TextView tvPhone;
    @BindView(R.id.tv_address)
    TextView tvAddress;
    @BindView(R.id.iv)
    ImageView iv;
    @BindView(R.id.tv_good_name)
    TextView tvGoodName;
    @BindView(R.id.tv_price)
    TextView tvPrice;
    @BindView(R.id.tv_number)
    TextView tvNumber;
    @BindView(R.id.tv_money)
    TextView tvMoney;
    @BindView(R.id.tv_order_number)
    TextView tvOrderNumber;
    @BindView(R.id.tv_order_time)
    TextView tvOrderTime;
    @BindView(R.id.tv_order_status)
    TextView tvOrderStatus;

    private OrderModel model;

    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_order_detail;
    }

    @Override
    protected void initInjector() {

    }

    @Override
    protected void initViews() {
        customToolbar.showBackIcon(this);

        model = (OrderModel) getIntent().getSerializableExtra("order");
        tvAddress.setText(model.getOAddress());
        tvGoodName.setText(model.getSName());
        tvMoney.setText("合计：￥" + model.getOAllmoney());
        tvNumber.setText("共" + model.getONum() + "件商品");
        tvName.setText("收货人：" + model.getOUser());
        tvOrderNumber.setText("订单编号：" + model.getOId());
        tvOrderTime.setText("下单时间：" + model.getOAddtime());
        tvPhone.setText(model.getOTel());
        tvPrice.setText("￥" + model.getOprice());
        tvOrderStatus.setText("订单状态：" + model.getOStates());
        GlideUtil.loadCommonBG(model.getSImg(), R.drawable.default_img, iv, this);
    }

    @Override
    protected void updateViews(boolean isRefresh) {

    }

    public static void launch(Context context, OrderModel model) {
        Intent intent = new Intent(context, OrderDetailActivity.class);
        intent.putExtra("order", model);
        context.startActivity(intent);
    }
}
